09. Shopping List

Part 2: Shopping List

Goal: The program below shows a shopping list. The raspberries cost $5. These lines of code should show the price of one, two, or three boxes of raspberries.

int raspberryPrice = 5;
display1("1 box: $" + raspberryPrice);
display2("2 boxes: $" + (raspberryPrice * 2));
display3("3 boxes: $" + (raspberryPrice * 3));

Was the goal accomplished?

SOLUTION: Yes

What is displayed for each line from the code above?

display1("1 box: $" + raspberryPrice);
SOLUTION: 1 box: $5

What is displayed for each line from the code above?

display2("2 boxes: $" + (raspberryPrice * 2));
SOLUTION: 2 boxes: $10

What is displayed for each line from the code above?

display3("3 boxes: $" + (raspberryPrice * 3));
SOLUTION: 3 boxes: $15